Skip to main content

FILTERYEAR

Checks if a date is within a specific year.

Description

Determines if a an array of dates falls within a specified year. It can handle arrays of dates or array of objects where a given key is a year entry.

Syntax

FILTERYEAR(dateitems, year, [key])

Arguments

  • dateitems: An array of Unix timestamps or objects containing timestamps.
  • year: The year to check against.
  • [key]: (Optional) If dateitems is an array of objects, this key specifies the property containing the Unix timestamp.

Example

ISYEAR([1678886400, 1681996800], 2023) → Returns [1678886400] (March 17, 2023 is in 2023, April 20, 2023 is not).
ISYEAR([{date: 1678886400}, {date: 1681996800}], 2023, "date") → Returns [{date: 1678886400}].